<!DOCTYPE html>
<title>Tests that an exception is thrown when calling 'video.captureStream' on a detached frame.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<body>
<script>
async_test(function(t) {
    var iframe = document.createElement("iframe");

    iframe.onload = t.step_func_done(function() {
        var video = iframe.contentDocument.getElementById("v");
        var iframeDOMException = iframe.contentWindow.DOMException;
        iframe.remove();
        assert_throws_dom("NotSupportedError", iframeDOMException,
            function() { video.captureStream(1.0); },
            "Failed to execute 'captureStream' on 'HTMLMediaElement': The context has been destroyed.");
    });

    iframe.src = "resources/iframe-with-video.html";
    document.body.appendChild(iframe);
});
</script>
</body>
